require 'rubygems'
require 'blather'
require 'pp'

include Blather

module Epic
	class Status
		attr_accessor :peers

		def initialize(client)
			@client = client
			@peers = {}
			setup
		end

		def setup
			@client.register_handler :status do |p| 
				@peers[p.from.stripped.to_s] = p.from.to_s
			end

			@client.register_handler :presence, :type => :unavailable do |p| 
				@peers.delete p.from.stripped.to_s
			end
		end

		def list
			@peers.keys
		end

		def get(bare_jid)
			@peers[bare_jid]
		end
	end
end
